define(
		[ "PDAppDir/properties", "PDUtilDir/util", "PDUtilDir/tool", "PDUtilDir/slidebar",
				"PDUtilDir/inputSelect",
				"PDUtilDir/fileupload/singleFileUpload", "Date", "DateCN",
				"css!DateCss", "PicView", "css!picViewCss",
				"css!AppPathDir/order/orderInfos/views/css/css" ],
		function(Properties, Util, Tool, Slidebar, inputSelect, MFU) {
			function applySupportInit($scope, $compile) {
				return new applySupport($scope, $compile);
			}
			function applySupport($scope, $compile) {
				this.$scope = $scope;
				this.$compile = $compile;
			}
			applySupport.fn = applySupport.prototype;
			applySupport.fn.digest = function() {
				this.$scope.$digest();
			}
			applySupport.fn.init = function(id) {
				var _this = this;
			    $.ajax({
					url : getServer() + "/flea/hclv/serviceOrder/findDetailById.htmls",
					data: {
				    	model : id,
				    },
					success : function(data) {
						_this.entity = $.extend(data.data.order, {
                            visitors: data.data.visitors
                        });
						_this.entity.orderStatusName = _this.$scope.cache.orderStatusMap.get(_this.entity.payStatus);
						_this.digest();
					}
				});
			};
			applySupport.fn.run = function(data) {
				var _this = this;
				_this.init(data);
				this.slidebars = Slidebar({
					size : 'lg',
					url : getServer()
							+ "/static/app/order/serviceOrderInfos/views/applyUpdate.html",
//					close : true,
					$scope : this.$scope,
					$compile : this.$compile,
					afterLoad : function($Panel) {
						_this.initialization();
					}
				});
			};
			applySupport.fn.initialization = function() {
				var _this = this;
                // 初始化支付类型下拉框
                inputSelect.dropCache();
                inputSelect({
                    id : "applyTypeName",
                    key : {
                        id : "dictCode",
                        name : "dictName",
                        data : "data",
                    },
                    data : _this.$scope.cache.applyTypes,
                    simpleData : true,
                    searchAble : false,
                    callback : function(id, obj) {
                        _this.entity.type = id[0];
                        _this.$scope.applyUpdateForm.type.$setViewValue(_this.entity.type);
                    }
                });
			};
			applySupport.fn.save = function() {
				var _this = this;
				$.ajax({
					url : getServer() + "/flea/hclv/serviceOrder/addServiceOrderUpdateApply.htmls",
					data : {
						'model' : JSON.stringify({
							serverOrderNo : _this.entity.orderNo,
							type: _this.entity.type,
							applerName : _this.entity.applerName,
							applerPhone : _this.entity.applerPhone,
							applerReason : _this.entity.applerReason
						})
					},
					success : function(data) {
                        if (data.status != 200) {
                            return;
                        }
						_this.$scope.grid.refresh();
						Util.alert('成功');
						_this.slidebars.close();
					}
				});
			};
			return applySupportInit;
		});